import time

f = open("D:/test.txt", 'w', encoding='UTF-8')
f.write("Hello world!!!")
f.flush()

time.sleep(10)


# 关闭文件
f.close()
